﻿@{
    Layout = "/Views/Shared/Shared.cshtml";
    var propic = ViewBag.ProductPic as ProductPic;
    var pro = ViewBag.Product as Product;
    //var user = ViewBag.User as User;

    var address = ViewBag.Address as List<UserAddress>;

}
@model Order;
<section>
    <div class="view-product">
        <div class="info-center">
            <el-card style="width: 100%;padding-bottom:20px" shadow="always" :body-style="{ padding: '0px' }">
                <el-row :gutter="20">
                    <el-col :span="4">
                        <div class="grid-content bg-purple" style="float:right;">
                            <img src="@propic.PicAddress" alt="" width="100px">
                        </div>
                    </el-col>
                    <el-col :span="20">
                        <div class="grid-content bg-purple">
                            @pro.Title
                        </div>
                        <div style="padding-top: 20px;">
                            <span>@Model.CreateTime</span>
                        </div>
                    </el-col>
                </el-row>
            </el-card>

            <table class="layui-table" lay-skin="nob" style="width:60%;margin-left:10%">
                <colgroup>
                    <col width="20%">
                    <col width="80%">
                </colgroup>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td style="font-size:25px ;">价格：</td>
                    <td style="font-size:25px ;color: orangered;">￥@pro.Price</td>
                </tr>
                <tr>
                    <td>描述：</td>
                    <td>@pro.Describe</td>
                </tr>
                <tr>
                    <td>品牌：</td>
                    <td>@pro.Brand</td>
                </tr>

                <tr>
                    <td>收货地址</td>
                    <td>
                        <form  class="layui-form">
                            <input type="hidden" value="@Model.Id" name="Id" />
                            <input type="hidden" class="form-control" name="Status" value="2">
                            <select name="ReceivingAddress" lay-verify="required" class="layui-input layui-unselect">

                                @foreach (var item in address.Where(x => x.UserID == @Model.UserId))
                                {

                                    <option value="@item.Id">@item.Name @item.Phone @item.Province @item.City @item.DisTrict @item.DetailedAddress</option>

                                }
                            </select>
                            <button lay-submit lay-filter="EditForm" class="layui-btn layui-btn-normal" style="float:right">下一步</button>
                            @*<button class="layui-btn" lay-submit lay-filter="EditForm">下一步</button>*@
                        </form>
                    </td>

                </tr>
                <tr>
                    <td></td>
                    <td>
                    </td>
                </tr>
            </table>

        </div>
    </div>
</section>
@section Scripts{

<script>
    layui.use(["form", 'layer'], function() {
        var form = layui.form;
        var $ = layui.$;
        var layer = layui.layer;
        form.on('submit(EditForm)', function(data) {
            console.log (data)
            $.post("/ZhiFu/Edit", data.field, function(res) {
                if (res.isSuccess) {
                    layer.msg(res.msg, function() {
                        window.location.href = "/zhifu/index/" + @Model.Id;
                    });
                } else {
                    layer.msg(res.msg);
                }
            });
            return false;
        });
    })
</script>
}
